package com.spring.application;

import com.spring.entity.Book;
import com.spring.entity.Coffie;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringApplication_5 {

    //带有生命周期方法的Bean
    @Test
    public void getBeanFactory(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-5.xml");
        Book book = context.getBean("book", Book.class);
        System.out.println(book);
        ((ClassPathXmlApplicationContext) context).destroy();
    }

    //测试后置处理器
    @Test
    public void getBeanmyBeanPostProcessor(){
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-5.xml");
        Book book = context.getBean("book", Book.class);
        System.out.println(book);

    }

}
